/**
    ATClab - scriptable Air Traffic Control simulations.
    Copyright (C) 2010 openatclab@gmail.com

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
**/

#ifndef __ATC_INTERSECTIONPOINT_HDR__
#define __ATC_INTERSECTIONPOINT_HDR__

#include <stdexcept>

class QPoint;

namespace atc{


	/*!
	 * \struct intersectionpoint_error
	 */
	struct intersectionpoint_error : public std::runtime_error{
		intersectionpoint_error(const std::string& msg) 
			:std::runtime_error(msg)
		{}
	};


	/*!
	 * \class atc::IntersectionPoint atc_intersectionpoint.h
	 */
	class IntersectionPoint  
	{
	public:

		IntersectionPoint(
			const QPoint &, const QPoint &, 
			const QPoint &, const QPoint &
		);
		virtual ~IntersectionPoint();

	public:

		bool coincident()const;
		bool parallel()const;

		QPoint point()const;

	private:

		int _u_denominator;
		int _ua_numerator;
		int _ub_numerator;

		int _x, _y;

	};

};

#endif
